<div class="section source-code">
    <p>
        {{ 'help.show_code'|trans|raw }}
    </p>

    <button type="button" class="btn btn-secondary py-3 btn-lg btn-block" data-toggle="modal" data-target="#sourceCodeModal">
        <twig:ux:icon name="tabler:code"/> {{ 'action.show_code'|trans }}
    </button>

    <div class="modal fade" id="sourceCodeModal" tabindex="-1">
        <div class="modal-dialog modal-xl">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><twig:ux:icon name="tabler:code"/> {{ 'title.source_code'|trans }}</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="{{ 'action.close'|trans }}">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>

                <div class="modal-body">
                    <ul class="nav nav-tabs" id="myTab" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active" id="controller-tab" data-toggle="tab" href="#controller-code" role="tab" aria-controls="home" aria-selected="true" target="_blank">{{ 'title.controller_code'|trans }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="template-tab" data-toggle="tab" href="#template-code" role="tab" aria-controls="profile" aria-selected="false" target="_blank">{{ 'title.twig_template_code'|trans }}</a>
                        </li>
                    </ul>

                    <div class="tab-content" id="myTabContent">
                        <div class="tab-pane show active" id="controller-code" role="tabpanel" aria-labelledby="controller-tab">
                            {% if controller %}
                                <p class="file-link">{{ link_source_file(controller.file_path, controller.starting_line) }}</p>
                                <pre><code class="php">{{ controller.source_code }}</code></pre>
                            {% else %}
                                <pre><code>{{ 'not_available'|trans }}</code></pre>
                            {% endif %}
                        </div>

                        <div class="tab-pane" id="template-code" role="tabpanel" aria-labelledby="template-tab">
                            <p class="file-link">{{ link_source_file(template.file_path, template.starting_line) }}</p>
                            <pre><code class="twig">{{ template.source_code }}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
